/**
 * bsw_comm.h
 * 一些共用代码片段
 * 
 * 竹影半墙
 * 2023.08
 */
#ifndef BSW_COMM_H
#define BSW_COMM_H

#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <assert.h>
#include <stdio.h>
#include <math.h>
#include <time.h>

typedef enum bsw_error_id bsw_error_id_e;

#if 0
#endif
enum bsw_error_id {
    BSW_OK = 0,
    BSW_BAD,
    BSW_OOM,
    BSW_SYS,
    BSW_PART,
    BSW_EXIST,
    BSW_NEXIST,
    BSW_DISCONN,
    BSW_COMPELET,
};

#define bsw_max(a,b)  ( (a) > (b) ? (a) : (b) )
#define bsw_min(a,b)  ( (a) < (b) ? (a) : (b) )
#define bsw_arrays(a) ( sizeof(a) / sizeof((a)[0])  )
#define bsw_startof(ptr, type, mbr) \
    ( (type*)( (char*)(ptr) - offsetof(type, mbr) ) )

#endif